///		VIOLENT CONFLICT AND EXPECTATION ABOUT THE ECONOMY'S PERFORMANCE: EVIDENCE FROM NIGERIA 
						
						*Daniel Tuki*
						
						
* This study is based on survey data collected from the Northern Nigerian state of Kaduna as part of the Transnational Perspectives on Migration and Integration (TRANSMIT) research project in 2021. For more information about the project vist: https://www.projekte.hu-berlin.de/en/transmit


//					VARIABLE OPERATIONALIZATION

// 		Depednent variable

* Economy improve (expect_economy): This measures respondents expectations regarding the Nigerian economy's future performance in five years' time. It was derievd from the "econdev" variable. To invert the ordinal values assiged to this variable so that higher values denote more optimism about the economy's future performance, I subtracted  "econdev" from 5: 
codebook econdev
gen improve_economy = 5 - econdev




// 		Explanatory variable

* Violent Conflict: This measures the total number of violent conflict incidents from 2015-2020 within a 30km buffer around the respondents geolocations. The conflict data was obtained from the Armed Conflict Location and Event Data Project (ACLED). I define violent conflicts as incidents that fall under any of the following three categories: Battles, Violence against civilians, and Explosions/Remote violence. I developed an alternative measure of the explanatory variable based on data obtained from the Global Terrorism Database (GTD). 




// 		Control variables

* Temperature (tmp_2020): This measures the mean annual temperature around the respondents' geolocations for the year 2020. The temperature variable was obtained from the Climatic Research Unit (CRU) at the University of East Anglia, UK. 


* Age (age) This measures how old respondents are in years. 
codebook age1


* Gender (gender1): Takes a value of 1 if respondent is female and 0 if male. 
tab gender1


* Marital status (married): Takes a value of 1 if respondent is married or has ever been married, and 0 otherwise. 
tab married


* Household income (hhecon): This measures the capacity of the household's income to meet the needs of its members on a scale with five ordinal categories ranging from "0 = money is not enough for food" to "4 = we can afford to buy almost anything." using the poorest category (i.e., money is not enough for food) as the reference category, I developed dummy variables for the remaing four categories. 
codebook hhecon 
*To develop dummy variables for the remaining four categories: 

* We can buy food
gen buy_food = 0
replace buy_food = 1 if hhecon == 1

* We can buy basic goods
gen buy_basics = 0
replace buy_basics = 1 if hhecon == 2

* We can buy durable goods
gen buy_durables = 0
replace buy_durables = 1 if hhecon == 3

* We can buy almost anything
gen buy_anything = 0
replace buy_anything = 1 if hhecon == 4


* Educational level (educ): This measures the highest educational level attained by respondents on an ordinal scale with ten categories ranging from "0 = no formal schooling" to "9 = masters degree and above"
codebook educ
tab educ
tab educ, nolabel
* I collapsed the nine resposne categories into four main categiries: No education, primary education, secondary education, and tertiary education. I used repondents who have no education as the reference category. I define "no education" as those who have no formal education or have only attended informal schools - i.e., koranic education. 

* Primary education (primary): This is a dummy variable that takes the value of 1 if the respondent has some primary education or had completed primary school. 
gen primary = 0 
replace primary = 1 if educ == 2
replace primary = 1 if educ == 3

* Secondary education (secondary): This is a dummy variable that takes the value of 1 if the respondent has some secondary education or has completed secondary school. 
gen secondary = 0 
replace secondary = 1 if educ == 4
replace secondary = 1 if educ == 5

* Tertiarty Education (tertiary): This is a dummy variable that takes a value of 1 if the respondent has obtained some post-secondary education, ever attended university, obtained a bachelor's degree or a master's degree
gen tertiary = 0 
replace tertiary = 1 if educ == 6
replace tertiary = 1 if educ == 7
replace tertiary = 1 if educ == 8
replace tertiary = 1 if educ == 9



// Instrumental variable

* Forest ratio: This measures the total number of forest cover pixels within the 30km buffer as a proportion of the total landcover pixels, expressed in percentage.This dataset was obtained from the Copernicus Global Landcover Database. 
gen forest_ratio_30km_2015 = (forest_2015_30km/allcover_2015_30km) * 100



//					REGRESSION MODELS 	

*Table 1: Regression results

* Correlational analysis

*Model 1: OProbit - Baseline model
oprobit improve_economy vio_acled_2015_2020_30km, vce(robust)

*Model 2: OProbit - Adding control variables
oprobit improve_economy vio_acled_2015_2020_30km buy_food buy_basics buy_durables buy_anything primary secondary tertiary age1 gender1 married tmp_2020, vce(robust)

* First-Stage regression

*Model 3: OLS - regressing conflict on forest
regress vio_acled_2015_2020_30km forest_ratio_30km_2015, vce(robust)

* Second-stage regressions

*Model 4: IVOProbit - Baseline
eoprobit improve_economy, endogenous (vio_acled_2015_2020_30km = forest_ratio_30km_2015)

*Model 5: IVOProbit - Adding control variables
eoprobit improve_economy buy_food buy_basics buy_durables buy_anything primary secondary tertiary age1 gender1 married tmp_2020, endogenous (vio_acled_2015_2020_30km = forest_ratio_30km_2015)

*Model 6: IVOProbit - Adding Local Government Area (LGA) fixed effects
eoprobit improve_economy buy_food buy_basics buy_durables buy_anything primary secondary tertiary age1 gender1 married tmp_2020 i.lga_id, endogenous (vio_acled_2015_2020_30km = forest_ratio_30km_2015)



// Figure 1: Average marginal effects of violent conflict on expected economic performance 

* Based on model 6: 
eoprobit improve_economy buy_food buy_basics buy_durables buy_anything primary secondary tertiary age1 gender1 married educ tmp_2020 i.lga_id, endogenous (vio_acled_2015_2020_30km = forest_ratio_30km_2015)
**To obtain the marginal effects 
margins, dydx(vio_acled_2015_2020_30km)
*To plot the marginal effects as a bar chart with confidence intervals
marginsplot, recast(bar) yline(0) name (vio_acled_2015_2020_30km, replace)



// 					APPENDIX

* Table A1: Replicating the results in Table 1 using alternative conflict data (GTD)

*Correlational analysis

*Model 1: OProbit - Baseline model
oprobit improve_economy gtd_2015_2020, vce(robust)

*Model 2: OProbit - Adding control variables
oprobit improve_economy gtd_2015_2020 buy_food buy_basics buy_durables buy_anything primary secondary tertiary age1 gender1 married tmp_2020, vce(robust)

*First-Stage regression

*Model 3: OLS - regressing conflict on forest
regress gtd_2015_2020 forest_ratio_30km_2015, vce(robust)

*Second-stage regressions

*Model 4: IVOProbit - Baseline
eoprobit improve_economy, endogenous (gtd_2015_2020 = forest_ratio_30km_2015)

*Model 5: IVOProbit - Adding control variables
eoprobit improve_economy buy_food buy_basics buy_durables buy_anything primary secondary tertiary age1 gender1 married tmp_2020, endogenous (gtd_2015_2020 = forest_ratio_30km_2015)

*Model 6: IVOProbit - Adding Local Government Area (LGA) fixed effects
eoprobit improve_economy buy_food buy_basics buy_durables buy_anything primary secondary tertiary age1 gender1 married tmp_2020 i.lga_id, endogenous (gtd_2015_2020 = forest_ratio_30km_2015)


// Figure A1: Average marginal effects of terrorist incidents on expected economic performance (GTD)

* Based on model 6 in Table A1: 
eoprobit improve_economy buy_food buy_basics buy_durables buy_anything primary secondary tertiary age1 gender1 married tmp_2020 i.lga_id, endogenous (gtd_2015_2020 = forest_ratio_30km_2015)
**To obtain the marginal effects 
margins, dydx(gtd_2015_2020)
*To plot the marginal effects as a bar chart with confidence intervals
marginsplot, recast(bar) yline(0) name (gtd_2015_2020, replace)


* Table A2: Descriptive statistics
summ improve_economy vio_acled_2015_2020_30km gtd_2015_2020 forest_2015_30km allcover_2015_30km forest_ratio_30km_2015 tmp_2020 buy_food buy_basics buy_durables buy_anything primary secondary tertiary age1 gender1 married 





/* Codes for sorting ACLED Dataset

*To access the ACLED dataset visit: https://acleddata.com/

*To keep only conflict incidents in Nigeria categorized as Violence against civilians, Battles, and Explosions/Remote violence: 
tab event_type
keep if country == "Nigeria"
drop if event_type == "Riots"
drop if event_type == "Protests"
drop if event_type == "Strategic developments"

* To drop events that occurred after 2020
drop if year > 2020
*To drop events that occurred before 2015
drop if year < 2015
tab year
tab country
tab event_type

*This leaves the events that I used to develop the explanatory variable -- i.e., Violent conflict. 
*/

